﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sharp.Domain.PlatformBoundedContext.PersonModule.Aggregates;

namespace Sharp.Domain.PlatformBoundedContext.ModelConfigurations
{
    public partial class EmployeeConfiguration
        : EntityTypeConfiguration<Employee>
    {
        public EmployeeConfiguration()
        {
            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);


            Property(t => t.Code)
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.JobId)
                .IsOptional();

            Property(t => t.Phone)
                .HasMaxLength(50).IsUnicode(false)
                .IsOptional();
            Property(t => t.Fax)
                .HasMaxLength(50).IsUnicode(false)
                .IsOptional();
            Property(t => t.Email)
                .HasMaxLength(50).IsUnicode(false)
                .IsOptional();
            Property(t => t.Address)
                .HasMaxLength(50)
                .IsOptional();

            Property(t => t.JobTitle)
                .HasMaxLength(20)
                .IsOptional();


            Property(t => t.IdCard)
                .IsUnicode(false)
                .IsOptional();

            Property(t => t.Birthday)
                .IsUnicode(false)
                .IsOptional();
            Property(t => t.RegisteredResidence)
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.WorkDate)
                .HasMaxLength(8)
                .IsOptional();


            Property(t => t.UrgentContact)
                .HasMaxLength(50)
                .IsOptional();

            Property(t => t.UrgentPhone)
                .HasMaxLength(50).IsUnicode(false)
                .IsOptional();

            Property(t => t.Remark)
                .HasMaxLength(255)
                .IsOptional();

            Property(t => t.CheckInTime)
                .IsRequired();
            Property(t => t.CheckInUserId)
                .IsRequired();
            Property(t => t.ModifiTime)
                .IsOptional();
            Property(t => t.ModifiedUserId)
                .IsOptional();

            // Relationships
 
        }
    }
}

